<template>
    <div class="management-less">
        <el-form :inline="true" :model="formInline" class="demo-form-inline t-a-l">
            <el-form-item label="姓名：">
                <el-input v-model="formInline.entity.user.name" placeholder=""></el-input>
            </el-form-item>
            <el-form-item label="手机号：">
                <el-input v-model="formInline.entity.user.phone" placeholder=""></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="certificateList">搜索</el-button>
                <el-button class="reset" @click="reset()">重置</el-button>
            </el-form-item>
        </el-form>
        <div class="border-s my-test">
            <el-table :data="tableData" style="width: 100%" :border="false">
                <el-table-column prop="user.name" label="姓名"></el-table-column>
                <el-table-column prop="examinee.corporation" label="单位"></el-table-column>
                <el-table-column prop="user.phone" label="手机号"></el-table-column>
                <el-table-column prop="examination.name" label="考试名称"></el-table-column>
                <el-table-column prop="examination.examTime" label="考试日期"></el-table-column>
                <el-table-column prop="post" label="是否邮寄" :formatter="postFormatter"></el-table-column>
                <el-table-column prop="examinee.postCode" label="邮编"></el-table-column>
                <el-table-column prop="examinee.postAddress" label="邮寄地址"></el-table-column>
                <el-table-column prop="expressNumber" label="快递单号"></el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button v-if="scope.row.post == 0" @click="centerDialogVisible = true,rejected.id = scope.row.id" type="text" size="medium" class="button-my-test">邮递</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <el-pagination
            background
            layout="total, sizes, prev, pager, next, jumper"
            :page-size="formInline.pageable.size"
            @current-change="handleCurrentChange"
            :page-sizes="[10, 20, 30, 40]"
            @size-change="pageFy"
            :total="total">
            </el-pagination>
        <el-dialog title="单号" class="rejected" :visible.sync="centerDialogVisible" width="30%" center>
            <el-form ref="form" :model="rejected" label-width="80px">
                <el-form-item label="请输入">
                    <el-input type="text" placeholder="快递单号" v-model="rejected.expressNumber"></el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button size="medium" @click="centerDialogVisible = false">取 消</el-button>
                <el-button size="medium" type="primary" @click="centerDialogVisible = false,confirm()">确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import apiHttp from '../../api/index.js'
export default {
    data(){
        return{
            formInline: {
                entity:{
                    user:{
                        name:"",
                        phone:""
                    },
                    status:4
                },
                pageable:{
                    current:1,
                    size:10
                },
            },
            tableData:[],
            centerDialogVisible:false,
            rejected:{
                id:'',
                expressNumber:''
            },
            total:0
        }
    },
    mounted(){
        this.certificateList()
    },
    methods:{
        // 重置搜索内容
        reset(){
            this.formInline.entity.user.name = ''
            this.formInline.entity.user.phone = ''
            this.certificateList()
        },
        // 证书邮寄列表
        certificateList(){
            apiHttp.apiIndex.sigupPage(this.formInline).then(resp=>{
                if(resp.code == 0){
                    this.tableData = resp.data.records
                    this.total = Number(resp.data.total)
                }
            })
        },
        postFormatter(row){
            return row.post == 0 ? '否' : '是'
        },
        handleCurrentChange(val){
            this.formInline.pageable.current = val
            this.certificateList()
        },
        pageFy(val){
            this.formInline.pageable.size = val
            this.certificateList()
        },
        // 通过
        confirm() {
            apiHttp.apiIndex.orderPost(this.rejected).then(resp=>{
                if(resp.code == 0){
                    this.certificateList()
                }
            })
      }
    }
}
</script>
<style lang="less">
.management-less{
    .el-form{
        .el-form-item{
            .el-form-item__content{
                .el-button--primary{
                    background-color: #5d2805;
                    border-color: #5d2805;
                }
            }
        }
    }
    .export-less{
        text-align: left;
        margin-bottom: 15px;
        .jiafei{
            display: block;
            margin-top: 15px;
        }
    }
    .el-table th{
        color: #fff;
        background-color: #5d2805;
    }
    .el-table td, .el-table th{
        text-align: center;
        font-size: 16px;
    }
    .rejected{
        .el-dialog__body{
            padding: 25px 25px 10px;
            .el-form-item__label{
                display: none;
            }
            .el-form-item__content{
                margin-left: 0 !important;
            }
        }
        .el-dialog__footer{
            .el-button--primary{
                background-color: #5d2805;
                border-color: #5d2805;
            }
            .el-button--default:hover{
                background-color: #e4d7cf;
                border-color: #e4d7cf;
                color: #5d2805;
            }
        }
        .el-textarea__inner{
            min-height: 100px !important;
        }
    }
}
.el-message-box__message{
    font-size: 18px;
}
</style>

